export GLOG_logtostderr=1
export GLOG_v=3
if [ $# -eq 0 ]; then
    chunk_size=64
else
    # 如果参数个数不为0，将第一个参数赋值给test_set
    chunk_size="$1"
fi

# shellcheck disable=SC2154
jit_model_path=/home/work_nfs15/asr_data/ckpt/asr_online_system/jit_script_chunk_"${chunk_size}"_left_1024.pt
unit_path=/home/work_nfs15/asr_data/ckpt/asr_online_system/lang_char_bpe/tokens.txt

test_set="aishell"
# shellcheck disable=SC2034
text_path=/home/work_nfs15/asr_data/data/asr_test_sets/${test_set}/text
scp_path=/home/work_nfs15/asr_data/data/asr_test_sets/${test_set}/wav.scp


output_dir=./decode_output
output_path=$output_dir/test_"$test_set"_no_ngram.text
output_path_wer=$output_dir/test_"$test_set"_no_ngram.wer
echo $output_path
../runtime/libtorch/build/bin/decoder_main \
    --chunk_size -1 \
    --rescoring_weight 5.0 \
    --wav_scp $scp_path \
    --continuous_decoding false \
    --model_path $jit_model_path \
    --unit_path $unit_path \
    --context_path context.list \
    --result $output_path 2>&1 | tee log_no_ngram.txt


python tools/compute-wer.py --char=1 --v=1 \
  $text_path $output_path > $output_path_wer

tail -n 10 $output_path_wer
